/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.trabalho;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Neylton
 */
public class Node implements Comparable<Node> {
    
    private Integer label;
    private List<Vertex> adjList;

    public Node() {
        adjList = new ArrayList<Vertex>();
    }

    public Integer getLabel() {
        return label;
    }

    public void setLabel(Integer label) {
        this.label = label;
    }

    public List<Vertex> getAdjList() {
        return adjList;
    }

    public void setAdjList(List<Vertex> adjList) {
        this.adjList = adjList;
    }

    public Integer getDegree() {
        return adjList.size();
    }

    @Override
    public String toString() {
        String str = "Vertice " + this.label;
        for (Vertex vertex : adjList) {
            str += " - " + vertex;
        }
        return str;
    }

    @Override
    public int compareTo(Node o) {
        
        if (this.getDegree() > o.getDegree()) {
            return -1;
        }
        if (this.getDegree() < o.getDegree()) {
            return 1;
        }
        return 0;
    }

}
